import java.util.concurrent.atomic.AtomicStampedReference;

public class MyAtomicStampedReference {

    private static AtomicStampedReference<Integer> count = new AtomicStampedReference<>(0, 0);

    public static void main(String[] args) {

        for(int i = 0; i< 10; i++){
            int index  = i;
            new Thread(() -> {
                count.compareAndSet(index, index + 1, index, count.getStamp() + 2);
            }).start();
        }

    }
}
